package org.lxw.stock;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

public class PanKou {
	public static void main(String[] args) throws Exception {
		long tt = 0;
		for (;;) {
			Thread.sleep(6000);
			URL url = new URL(
					"http://qt.gtimg.cn/q=sh601398,sh600178,sh600552,sh600308");
			URLConnection connection = url.openConnection();
			InputStream in = connection.getInputStream();
			BufferedReader read = new BufferedReader(new InputStreamReader(in));
			String line = null;
			
			boolean f = false;
			while ((line = read.readLine()) != null) {
				if (f) {
					System.out.println(line);
					continue;
				}
				String[] strings = line.split("~");
				long t = Long.parseLong(strings[30]);
				if (tt < t) {
					tt = t;
					f = true;
					System.out.println(line);
				}
			}
		}
	}
}
